%module my_array
%{
unsigned int *alloc_array(unsigned int num);
void free_array(unsigned int *data);
void increase_A(unsigned int *data, unsigned int col_siz);
void increase_B(unsigned int (*data)[8], unsigned int col_siz);
%}

unsigned int *alloc_array(unsigned int num);
void free_array(unsigned int *data);
void increase_A(unsigned int *data, unsigned int col_siz);
void increase_B(unsigned int (*data)[8], unsigned int col_siz);
%include "carrays.i"
%include "cdata.i"
%array_class(unsigned int, uint_array);

%inline %{
// 分配一个二维数组，其中第1维的长度是8，第2维长度是row
unsigned int (*ptr_uint_array_8(unsigned int row))[8]{
    return (unsigned int (*) [8])malloc(row * 8 * sizeof(unsigned int));
}
// 将一维数组转换为二维数组
unsigned int (*puint_to_p2d(unsigned int *x))[8]{
    return (unsigned int (*) [8])x;
}
// 将二维数组转换为一维数组
unsigned int *p2d_to_puint(unsigned int (*x)[8]){
    return (unsigned int *)x;
}
%}
